<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .white{
            width: 100%;
            height: 200px;
        }
        .black{
            width: 100%;
            height: 200px;
            background-color: black;
        }
        button{
            width: 50px;
            height: 50px;
            background-color: aquamarine;
        }
    </style>
</head>
<body>
    <hr>
    <div class="white"><button class="big">开关灯</button></div>
    <div class="black"><button class="small">开关灯</button></div>
</body>
</html>
<script>
    var big=document.querySelector('.big')
    var small=document.querySelector('.small')
    var white=document.querySelector('.white')
    var black=document.querySelector('.black')
    var flag=1
    big.onclick=function(){
        if(flag==1){
            white.className='black'
            flag=0;
        }else{
            white.className='white'
            flag=1;
        }
    }
    var flag1=1;
    small.onclick=function(){
        if(flag1==1){
            black.className='white'
            flag1=0;
        }else{
            white.className='black'
            flag1=1;
        }
    }
</script>